package com.example.demo.repository;


import com.example.demo.entity.Comment;
import com.example.demo.entity.Post;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface CommentRepository extends JpaRepository<Comment, Long> {
    //根据Post来获取评论
    List<Comment> findByPost(Post post);

    //使用Username获取评论
    List<Comment> findByUser_Username(String username);

    //根据UserId获取评论
    List<Comment> findByUser_Id(Long userId);
}
